package 组合模式;

import java.util.ArrayList;
import java.util.List;

public class BatchDog extends Dog {

    private List<Dog> dogList = new ArrayList<Dog>();

    public BatchDog(String name) {
        super(name);
    }

    @Override
    public void dance() {
        System.out.println(this.name + " :打修狗...");
        for (Dog dog : dogList) {
            dog.dance();
        }
    }

    @Override
    public Dog getChild(int i) {
        return dogList.get(i);
    }

    @Override
    public List<Dog> getChilds() {
        return dogList;
    }
}
